export function textSize(fontSize: string, text: string, length: number) {
	const span = document.createElement('span');
	const result = { width: 0, height: 0 };
	// result.width = span.offsetWidth;
	// result.height = span.offsetHeight;
	span.style.visibility = 'hidden';
	span.style.fontSize = fontSize;
	span.style.position = 'absolute';
	span.style.top = '0';
	span.style.zIndex = '-100';
	// span.style.fontFamily = fontFamily;
	// span.style.display = 'inline-block';
	document.body.appendChild(span);
	if (typeof span.textContent != 'undefined') {
		span.textContent = text;
	} else {
		span.innerText = text;
	}
	result.width = parseFloat(window.getComputedStyle(span).width);
	result.height = parseFloat(window.getComputedStyle(span).height);
	document.body.removeChild(span);
	return result;
}
